package com.cody.date160125;

/**
 * the useage of the StackTraceElement class
 * Created by cody on 16/1/25.
 */
public class Exercise1 {

    public static void main(String[] args) {
        new TestM().OuterMethod();
    }

    public void methodA(){
        methodB();
    }

    public void methodB(){
        methodC();
    }
    public void methodD() {

    }

    public void methodC(){
        StackTraceElement[] stacks = Thread.currentThread().getStackTrace();
        methodD();
        int i = 0;
        for(StackTraceElement s: stacks){
            System.out.println(++i + ". "+s.getMethodName()+" : "+s);
        }
    }

}

class TestM {
    public void OuterMethod(){
        new Exercise1().methodA();
    }
}
